﻿namespace CSharpPro._1027;

public class Demo
{
    private int id;//字段 feild
    private string name;
    private int age;

    //属性 property
    public int Id
    {
        get => id;
        set => id = value;

    }

    public string Name
    {
        get => name; 
        set => name = value ?? throw new ArgumentNullException(nameof(value));
    }

    public int Age
    {
        get => age;
        set => age = value;
    }
    public void TestPrint()
    {
        Parent parent = new Parent();
        parent.Print();
        Child child = new Child();
        child.Print();
        child.Play();
        Console.WriteLine("-------");
        Parent p1 = new Child();
        
        UserTestChild userTestChild = new UserTestChild();
        userTestChild.M1();
        userTestChild.M2();
        userTestChild.M3();
        
        UserServiceImpl userService = new UserServiceImpl();
        userService.Add();
        userService.Delete();
        userService.Update();
        userService.Query();
        
        //int result = Add(10,20); //实参
        //Console.WriteLine(result);
        //int i = Convert.ToInt32("123");
        //Console.WriteLine(i);
    }
    
    //重载
    public int Add(int a, int b)//形参
    {
        return a + b;
    }

    public string Add(string a, string b)
    {
        return a + b;
    }
    
}